Change in openvpn[master]: t_server_null: multiple improvements and fixes
A message that is not in the archive (sent off-list or not yet received): gerrit.1718899574000.I2cce8ad4e0d262e1404ab1eb6ff673d8590b6b3a@...2715...
Attention is currently required from: flichtenheld, plaisthos.
Hello plaisthos, flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/669?usp=email
to review the following change.
Change subject: t_server_null: multiple improvements and fixes
......................................................................
t_server_null: multiple improvements and fixes
- exit after a timeout if unable to kill servers
- use sudo or equivalent only for server stop/start
- use /bin/sh directly instead of through /usr/bin/env
- simplify sudo call in the sample rc file
- remove misleading and outdated documentation
---
M doc/t_server_null.rst
M tests/t_server_null.rc-sample
M tests/t_server_null.sh
M tests/t_server_null_client.sh
M tests/t_server_null_server.sh
M tests/t_server_null_stress.sh
6 files changed, 41 insertions(+), 32 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/669/1
doc/t_server_null.rst +0 -7
@@ -73,13 +73,6 @@ * Waits until servers have launched. Then launch all clients, wait for them to exit and then check test results by parsing the client log files. Each client kills itself after some delay using an "--up" script. -Note that "make check" moves on once *t_server_null_client.sh* has exited. At -that point *t_server_null_server.sh* is still running, because it exists only -after waiting a few seconds for more client connections to potentially appear. -This is a feature and not a bug, but means that launching "make check" runs too -quickly might cause test failures or unexpected behavior such as leftover -OpenVPN server processes. - Configuration -------------
tests/t_server_null.rc-sample +1 -2
@@ -1,6 +1,5 @@ # Uncomment to run tests with sudo -#SUDO_EXEC=`which sudo` -#RUN_SUDO="${SUDO_EXEC} -E" +#RUN_SUDO="sudo -E" TEST_RUN_LIST="1 2 3 10 11"
tests/t_server_null.sh +2 -7
@@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh # TSERVER_NULL_SKIP_RC="${TSERVER_NULL_SKIP_RC:-77}"
@@ -57,12 +57,7 @@ srcdir="${srcdir:-.}" -if [ -z "${RUN_SUDO}" ]; then - "${srcdir}/t_server_null_server.sh" & -else - $RUN_SUDO "${srcdir}/t_server_null_server.sh" & -fi - +"${srcdir}/t_server_null_server.sh" & "${srcdir}/t_server_null_client.sh" retval=$?
tests/t_server_null_client.sh +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh launch_client() { test_name=$1
tests/t_server_null_server.sh +36 -14
71 lines not on this page · raw message
tests/t_server_null_stress.sh +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh # # Run this stress test as root to avoid sudo authorization from timing out.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/669?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2cce8ad4e0d262e1404ab1eb6ff673d8590b6b3a
Gerrit-Change-Number: 669
Gerrit-PatchSet: 1
Gerrit-Owner: mattock <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: flichtenheld, plaisthos.
Hello flichtenheld, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/669?usp=email
to look at the new patch set (#2).
Change subject: t_server_null: multiple improvements and fixes
......................................................................
t_server_null: multiple improvements and fixes
- exit after a timeout if unable to kill servers
- use sudo or equivalent only for server stop/start
- use /bin/sh directly instead of through /usr/bin/env
- simplify sudo call in the sample rc file
- remove misleading and outdated documentation
- make it work on OpenBSD 7.5
---
M doc/t_server_null.rst
M tests/t_server_null.rc-sample
M tests/t_server_null.sh
M tests/t_server_null_client.sh
M tests/t_server_null_default.rc
M tests/t_server_null_server.sh
M tests/t_server_null_stress.sh
7 files changed, 61 insertions(+), 40 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/669/2
doc/t_server_null.rst +6 -7
@@ -43,6 +43,12 @@ * run as root * a privilege escalation tool (sudo, doas, su) and the permission to become root +If you use "doas" you should enable nopass feature in */etc/doas.conf*. For +example to allow users in the *wheel* group to run commands without a password +prompt:: + + permit persist keepenv :wheel + Technical implementation ------------------------
@@ -73,13 +79,6 @@ * Waits until servers have launched. Then launch all clients, wait for them to exit and then check test results by parsing the client log files. Each client kills itself after some delay using an "--up" script. -Note that "make check" moves on once *t_server_null_client.sh* has exited. At -that point *t_server_null_server.sh* is still running, because it exists only -after waiting a few seconds for more client connections to potentially appear. -This is a feature and not a bug, but means that launching "make check" runs too -quickly might cause test failures or unexpected behavior such as leftover -OpenVPN server processes. - Configuration -------------
tests/t_server_null.rc-sample +1 -2
@@ -1,6 +1,5 @@ # Uncomment to run tests with sudo -#SUDO_EXEC=`which sudo` -#RUN_SUDO="${SUDO_EXEC} -E" +#RUN_SUDO="sudo -E" TEST_RUN_LIST="1 2 3 10 11"
tests/t_server_null.sh +2 -7
@@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh # TSERVER_NULL_SKIP_RC="${TSERVER_NULL_SKIP_RC:-77}"
@@ -57,12 +57,7 @@ srcdir="${srcdir:-.}" -if [ -z "${RUN_SUDO}" ]; then - "${srcdir}/t_server_null_server.sh" & -else - $RUN_SUDO "${srcdir}/t_server_null_server.sh" & -fi - +"${srcdir}/t_server_null_server.sh" & "${srcdir}/t_server_null_client.sh" retval=$?
tests/t_server_null_client.sh +10 -6
@@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh launch_client() { test_name=$1
@@ -76,19 +76,22 @@ count=0 server_max_wait=15 while [ $count -lt $server_max_wait ]; do - server_pids="" - server_count=$(set|grep 'SERVER_NAME_'|wc -l) + servers_up=0 + server_count=$(echo $TEST_SERVER_LIST|wc -w) # We need to trim single-quotes because some shells return quoted values # and some don't. Using "set -o posix" which would resolve this problem is # not supported in all shells. + # + # While inactive server configurations may get checked they won't increase + # the active server count as the processes won't be running. for i in `set|grep 'SERVER_NAME_'|cut -d "=" -f 2|tr -d "[\']"`; do server_pid=$(cat $i.pid 2> /dev/null) - server_pids="${server_pids} ${server_pid}" + if ps -p $server_pid > /dev/null 2>&1; then + servers_up=$(( $servers_up + 1 )) + fi done - servers_up=$(ps -p $server_pids 2>/dev/null|sed '1d'|wc -l) - echo "OpenVPN test servers up: ${servers_up}/${server_count}" if [ $servers_up -ge $server_count ]; then
@@ -101,6 +104,7 @@ if [ $count -eq $server_max_wait ]; then retval=1 + exit $retval fi done
tests/t_server_null_default.rc +5 -3
@@ -24,7 +24,7 @@ MAX_CLIENTS="10" CLIENT_MATCH="Test-Client" SERVER_EXEC="${top_builddir}/src/openvpn/openvpn" -SERVER_BASE_OPTS="--daemon --local 127.0.0.1 --dev tun --topology subnet --server 10.29.41.0 255.255.255.0 --max-clients $MAX_CLIENTS --persist-tun --verb 3" +SERVER_BASE_OPTS="--daemon --local 127.0.0.1 --dev tun --topology subnet --max-clients $MAX_CLIENTS --persist-tun --verb 3" SERVER_CIPHER_OPTS="" SERVER_CERT_OPTS="--ca ${CA} --dh ${DH} --cert ${SERVER_CERT} --key ${SERVER_KEY} --tls-auth ${TA} 0" SERVER_CONF_BASE="${SERVER_BASE_OPTS} ${SERVER_CIPHER_OPTS} ${SERVER_CERT_OPTS}"
@@ -32,14 +32,16 @@ TEST_SERVER_LIST="1 2" SERVER_NAME_1="t_server_null_server-1194_udp" +SERVER_SERVER_1="--server 10.29.41.0 255.255.255.0" SERVER_MGMT_PORT_1="11194" SERVER_EXEC_1="${SERVER_EXEC}" -SERVER_CONF_1="${SERVER_CONF_BASE} --lport 1194 --proto udp --management 127.0.0.1 ${SERVER_MGMT_PORT_1}" +SERVER_CONF_1="${SERVER_CONF_BASE} ${SERVER_SERVER_1} --lport 1194 --proto udp --management 127.0.0.1 ${SERVER_MGMT_PORT_1}" SERVER_NAME_2="t_server_null_server-1195_tcp" +SERVER_SERVER_2="--server 10.29.42.0 255.255.255.0" SERVER_MGMT_PORT_2="11195" SERVER_EXEC_2="${SERVER_EXEC}" -SERVER_CONF_2="${SERVER_CONF_BASE} --lport 1195 --proto tcp --management 127.0.0.1 ${SERVER_MGMT_PORT_2}" +SERVER_CONF_2="${SERVER_CONF_BASE} ${SERVER_SERVER_2} --lport 1195 --proto tcp --management 127.0.0.1 ${SERVER_MGMT_PORT_2}" # Test client configurations CLIENT_EXEC="${top_builddir}/src/openvpn/openvpn"
tests/t_server_null_server.sh +36 -14
71 lines not on this page · raw message
tests/t_server_null_stress.sh +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh # # Run this stress test as root to avoid sudo authorization from timing out.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/669?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2cce8ad4e0d262e1404ab1eb6ff673d8590b6b3a
Gerrit-Change-Number: 669
Gerrit-PatchSet: 2
Gerrit-Owner: mattock <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: mattock, plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/669?usp=email )
Change subject: t_server_null: multiple improvements and fixes
......................................................................
Patch Set 2:
(1 comment)
File doc/t_server_null.rst:
http://gerrit.openvpn.net/c/openvpn/+/669/comment/2a63132b_5f3ac97d :
PS2, Line 50: permit persist keepenv :wheel
doesn't contain "nopass" ?
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/669?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2cce8ad4e0d262e1404ab1eb6ff673d8590b6b3a
Gerrit-Change-Number: 669
Gerrit-PatchSet: 2
Gerrit-Owner: mattock <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: mattock <[email protected]...>
Gerrit-Comment-Date: Tue, 25 Jun 2024 13:15:18 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: mattock, plaisthos.
Hello flichtenheld, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/669?usp=email
to look at the new patch set (#3).
Change subject: t_server_null: multiple improvements and fixes
......................................................................
t_server_null: multiple improvements and fixes
- exit after a timeout if unable to kill servers
- use sudo or equivalent only for server stop/start
- use /bin/sh directly instead of through /usr/bin/env
- simplify sudo call in the sample rc file
- remove misleading and outdated documentation
- make it work on OpenBSD 7.5
---
M doc/t_server_null.rst
M tests/t_server_null.rc-sample
M tests/t_server_null.sh
M tests/t_server_null_client.sh
M tests/t_server_null_default.rc
M tests/t_server_null_server.sh
M tests/t_server_null_stress.sh
7 files changed, 61 insertions(+), 40 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/669/3
doc/t_server_null.rst +6 -7
@@ -43,6 +43,12 @@ * run as root * a privilege escalation tool (sudo, doas, su) and the permission to become root +If you use "doas" you should enable nopass feature in */etc/doas.conf*. For +example to allow users in the *wheel* group to run commands without a password +prompt:: + + permit nopass keepenv :wheel + Technical implementation ------------------------
@@ -73,13 +79,6 @@ * Waits until servers have launched. Then launch all clients, wait for them to exit and then check test results by parsing the client log files. Each client kills itself after some delay using an "--up" script. -Note that "make check" moves on once *t_server_null_client.sh* has exited. At -that point *t_server_null_server.sh* is still running, because it exists only -after waiting a few seconds for more client connections to potentially appear. -This is a feature and not a bug, but means that launching "make check" runs too -quickly might cause test failures or unexpected behavior such as leftover -OpenVPN server processes. - Configuration -------------
tests/t_server_null.rc-sample +1 -2
@@ -1,6 +1,5 @@ # Uncomment to run tests with sudo -#SUDO_EXEC=`which sudo` -#RUN_SUDO="${SUDO_EXEC} -E" +#RUN_SUDO="sudo -E" TEST_RUN_LIST="1 2 3 10 11"
tests/t_server_null.sh +2 -7
@@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh # TSERVER_NULL_SKIP_RC="${TSERVER_NULL_SKIP_RC:-77}"
@@ -57,12 +57,7 @@ srcdir="${srcdir:-.}" -if [ -z "${RUN_SUDO}" ]; then - "${srcdir}/t_server_null_server.sh" & -else - $RUN_SUDO "${srcdir}/t_server_null_server.sh" & -fi - +"${srcdir}/t_server_null_server.sh" & "${srcdir}/t_server_null_client.sh" retval=$?
tests/t_server_null_client.sh +10 -6
@@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh launch_client() { test_name=$1
@@ -76,19 +76,22 @@ count=0 server_max_wait=15 while [ $count -lt $server_max_wait ]; do - server_pids="" - server_count=$(set|grep 'SERVER_NAME_'|wc -l) + servers_up=0 + server_count=$(echo $TEST_SERVER_LIST|wc -w) # We need to trim single-quotes because some shells return quoted values # and some don't. Using "set -o posix" which would resolve this problem is # not supported in all shells. + # + # While inactive server configurations may get checked they won't increase + # the active server count as the processes won't be running. for i in `set|grep 'SERVER_NAME_'|cut -d "=" -f 2|tr -d "[\']"`; do server_pid=$(cat $i.pid 2> /dev/null) - server_pids="${server_pids} ${server_pid}" + if ps -p $server_pid > /dev/null 2>&1; then + servers_up=$(( $servers_up + 1 )) + fi done - servers_up=$(ps -p $server_pids 2>/dev/null|sed '1d'|wc -l) - echo "OpenVPN test servers up: ${servers_up}/${server_count}" if [ $servers_up -ge $server_count ]; then
@@ -101,6 +104,7 @@ if [ $count -eq $server_max_wait ]; then retval=1 + exit $retval fi done
tests/t_server_null_default.rc +5 -3
@@ -24,7 +24,7 @@ MAX_CLIENTS="10" CLIENT_MATCH="Test-Client" SERVER_EXEC="${top_builddir}/src/openvpn/openvpn" -SERVER_BASE_OPTS="--daemon --local 127.0.0.1 --dev tun --topology subnet --server 10.29.41.0 255.255.255.0 --max-clients $MAX_CLIENTS --persist-tun --verb 3" +SERVER_BASE_OPTS="--daemon --local 127.0.0.1 --dev tun --topology subnet --max-clients $MAX_CLIENTS --persist-tun --verb 3" SERVER_CIPHER_OPTS="" SERVER_CERT_OPTS="--ca ${CA} --dh ${DH} --cert ${SERVER_CERT} --key ${SERVER_KEY} --tls-auth ${TA} 0" SERVER_CONF_BASE="${SERVER_BASE_OPTS} ${SERVER_CIPHER_OPTS} ${SERVER_CERT_OPTS}"
@@ -32,14 +32,16 @@ TEST_SERVER_LIST="1 2" SERVER_NAME_1="t_server_null_server-1194_udp" +SERVER_SERVER_1="--server 10.29.41.0 255.255.255.0" SERVER_MGMT_PORT_1="11194" SERVER_EXEC_1="${SERVER_EXEC}" -SERVER_CONF_1="${SERVER_CONF_BASE} --lport 1194 --proto udp --management 127.0.0.1 ${SERVER_MGMT_PORT_1}" +SERVER_CONF_1="${SERVER_CONF_BASE} ${SERVER_SERVER_1} --lport 1194 --proto udp --management 127.0.0.1 ${SERVER_MGMT_PORT_1}" SERVER_NAME_2="t_server_null_server-1195_tcp" +SERVER_SERVER_2="--server 10.29.42.0 255.255.255.0" SERVER_MGMT_PORT_2="11195" SERVER_EXEC_2="${SERVER_EXEC}" -SERVER_CONF_2="${SERVER_CONF_BASE} --lport 1195 --proto tcp --management 127.0.0.1 ${SERVER_MGMT_PORT_2}" +SERVER_CONF_2="${SERVER_CONF_BASE} ${SERVER_SERVER_2} --lport 1195 --proto tcp --management 127.0.0.1 ${SERVER_MGMT_PORT_2}" # Test client configurations CLIENT_EXEC="${top_builddir}/src/openvpn/openvpn"
tests/t_server_null_server.sh +36 -14
71 lines not on this page · raw message
tests/t_server_null_stress.sh +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh # # Run this stress test as root to avoid sudo authorization from timing out.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/669?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2cce8ad4e0d262e1404ab1eb6ff673d8590b6b3a
Gerrit-Change-Number: 669
Gerrit-PatchSet: 3
Gerrit-Owner: mattock <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: mattock <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: mattock, plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/669?usp=email )
Change subject: t_server_null: multiple improvements and fixes
......................................................................
Patch Set 3: Code-Review-1
(2 comments)
Patchset:
PS3:
Still need to fix nbsd81 build. Otherwise looks good to me.
File doc/t_server_null.rst:
http://gerrit.openvpn.net/c/openvpn/+/669/comment/0f4fbfc2_5a621e23 :
PS2, Line 50: permit persist keepenv :wheel
Quoted 1 line
doesn't contain "nopass" ?
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/669?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2cce8ad4e0d262e1404ab1eb6ff673d8590b6b3a
Gerrit-Change-Number: 669
Gerrit-PatchSet: 3
Gerrit-Owner: mattock <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: mattock <[email protected]...>
Gerrit-Comment-Date: Wed, 26 Jun 2024 09:25:01 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: mattock, plaisthos.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/669?usp=email )
Change subject: t_server_null: multiple improvements and fixes
......................................................................
Patch Set 4:
(1 comment)
Patchset:
PS4:
So this works on FreeBSD and OpenBSD (great), while on NetBSD it works *sometimes*, and then it fails to start servers again because the old servers are still running.
When it does not work, the error message could use some improvement
```
make check-TESTS
./t_server_null.sh: sudo /bin/kill -0 succeeded, good.
OpenVPN test servers up: 0/ 2
OpenVPN test servers up: 0/ 2
OpenVPN test servers up: 0/ 2
OpenVPN test servers up: 0/ 2
OpenVPN test servers up: 0/ 2
OpenVPN test servers up: 0/ 2
All clients have disconnected from all servers
Waiting for servers to exit
cat: ./t_server_null_server-1194_udp.pid: No such file or directory
Terminated
[1] Terminated ("${@}" 2>&1; es... | tee -a "${log_fi...
```(like, showing a "tail -f" of the server logs? - which are root-owned and mode 0600, so not trivial. Why are they 0600 anyway, is there an explicit umask call?)
Not sure why the processes got stuck. When running from the CLI the servers are properly terminated... need to re-test from buildbot.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/669?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2cce8ad4e0d262e1404ab1eb6ff673d8590b6b3a
Gerrit-Change-Number: 669
Gerrit-PatchSet: 4
Gerrit-Owner: mattock <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: mattock <[email protected]...>
Gerrit-Comment-Date: Wed, 03 Jul 2024 14:13:57 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: mattock, plaisthos.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/669?usp=email )
Change subject: t_server_null: multiple improvements and fixes
......................................................................
Patch Set 4:
(1 comment)
Patchset:
PS4:
not tail -f, obviously, I was thinking about tail -20 or so, in case the log ends up being huge
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/669?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2cce8ad4e0d262e1404ab1eb6ff673d8590b6b3a
Gerrit-Change-Number: 669
Gerrit-PatchSet: 4
Gerrit-Owner: mattock <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: mattock <[email protected]...>
Gerrit-Comment-Date: Wed, 03 Jul 2024 14:16:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: mattock, plaisthos.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/669?usp=email )
Change subject: t_server_null: multiple improvements and fixes
......................................................................
Patch Set 4: Code-Review-1
(1 comment)
Patchset:
PS4:
OK, so the NetBSD problem seems to be "umask"
- when run from BB, the server processes are started (sudo openvpn...) just fine
- the resulting PID file (and Log file) are 600
``` -rw------- 1 root users 6 Jul 3 16:22 t_server_null_server-1194_udp.pid -rw------- 1 root users 5 Jul 3 16:22 t_server_null_server-1195_tcp.pid -rw------- 1 root users 227 Jul 3 16:24 t_server_null_server-1195_tcp.status -rw------- 1 root users 1991 Jul 3 16:24 t_server_null_server-1195_tcp.log -rw------- 1 root users 227 Jul 3 16:24 t_server_null_server-1194_udp.status -rw------- 1 root users 1824 Jul 3 16:24 t_server_null_server-1194_udp.log ```
- some other element running as non-root cannot read the pid file, so assumes "the server process must have been not started", and neither proceeds with the client
- since "the server has not been started" it's not killed either, and on the next run, the port is in use
My suggestion would be to add an umask 022 to the script that starts the server processes (I do not feel like digging into "why does BB set 077, when the system default is 022", and it *will* bite someone else running from the CLI eventually)
Also, error handling, for "there is a file and I can't read it".
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/669?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2cce8ad4e0d262e1404ab1eb6ff673d8590b6b3a
Gerrit-Change-Number: 669
Gerrit-PatchSet: 4
Gerrit-Owner: mattock <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: mattock <[email protected]...>
Gerrit-Comment-Date: Wed, 03 Jul 2024 14:30:03 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: cron2, flichtenheld, mattock, plaisthos.
Hello cron2, flichtenheld, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/669?usp=email
to look at the new patch set (#5).
The following approvals got outdated and were removed:
Code-Review-1 by cron2, Code-Review-1 by flichtenheld
Change subject: t_server_null: multiple improvements and fixes
......................................................................
t_server_null: multiple improvements and fixes
- exit after a timeout if unable to kill servers
- use sudo or equivalent only for server stop/start
- use /bin/sh directly instead of through /usr/bin/env
- simplify sudo call in the sample rc file
- remove misleading and outdated documentation
- make it work on OpenBSD 7.5
- make it work on NetBSD 10.0
- make server logs readable by normal users
---
M doc/t_server_null.rst
M tests/t_server_null.rc-sample
M tests/t_server_null.sh
M tests/t_server_null_client.sh
M tests/t_server_null_default.rc
M tests/t_server_null_server.sh
M tests/t_server_null_stress.sh
7 files changed, 64 insertions(+), 40 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/669/5
doc/t_server_null.rst +6 -7
@@ -43,6 +43,12 @@ * run as root * a privilege escalation tool (sudo, doas, su) and the permission to become root +If you use "doas" you should enable nopass feature in */etc/doas.conf*. For +example to allow users in the *wheel* group to run commands without a password +prompt:: + + permit nopass keepenv :wheel + Technical implementation ------------------------
@@ -73,13 +79,6 @@ * Waits until servers have launched. Then launch all clients, wait for them to exit and then check test results by parsing the client log files. Each client kills itself after some delay using an "--up" script. -Note that "make check" moves on once *t_server_null_client.sh* has exited. At -that point *t_server_null_server.sh* is still running, because it exists only -after waiting a few seconds for more client connections to potentially appear. -This is a feature and not a bug, but means that launching "make check" runs too -quickly might cause test failures or unexpected behavior such as leftover -OpenVPN server processes. - Configuration -------------
tests/t_server_null.rc-sample +1 -2
@@ -1,6 +1,5 @@ # Uncomment to run tests with sudo -#SUDO_EXEC=`which sudo` -#RUN_SUDO="${SUDO_EXEC} -E" +#RUN_SUDO="sudo -E" TEST_RUN_LIST="1 2 3 10 11"
tests/t_server_null.sh +2 -7
@@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh # TSERVER_NULL_SKIP_RC="${TSERVER_NULL_SKIP_RC:-77}"
@@ -57,12 +57,7 @@ srcdir="${srcdir:-.}" -if [ -z "${RUN_SUDO}" ]; then - "${srcdir}/t_server_null_server.sh" & -else - $RUN_SUDO "${srcdir}/t_server_null_server.sh" & -fi - +"${srcdir}/t_server_null_server.sh" & "${srcdir}/t_server_null_client.sh" retval=$?
tests/t_server_null_client.sh +10 -6
@@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh launch_client() { test_name=$1
@@ -76,19 +76,22 @@ count=0 server_max_wait=15 while [ $count -lt $server_max_wait ]; do - server_pids="" - server_count=$(set|grep 'SERVER_NAME_'|wc -l) + servers_up=0 + server_count=$(echo $TEST_SERVER_LIST|wc -w) # We need to trim single-quotes because some shells return quoted values # and some don't. Using "set -o posix" which would resolve this problem is # not supported in all shells. + # + # While inactive server configurations may get checked they won't increase + # the active server count as the processes won't be running. for i in `set|grep 'SERVER_NAME_'|cut -d "=" -f 2|tr -d "[\']"`; do server_pid=$(cat $i.pid 2> /dev/null) - server_pids="${server_pids} ${server_pid}" + if ps -p $server_pid > /dev/null 2>&1; then + servers_up=$(( $servers_up + 1 )) + fi done - servers_up=$(ps -p $server_pids 2>/dev/null|sed '1d'|wc -l) - echo "OpenVPN test servers up: ${servers_up}/${server_count}" if [ $servers_up -ge $server_count ]; then
@@ -101,6 +104,7 @@ if [ $count -eq $server_max_wait ]; then retval=1 + exit $retval fi done
tests/t_server_null_default.rc +5 -3
@@ -24,7 +24,7 @@ MAX_CLIENTS="10" CLIENT_MATCH="Test-Client" SERVER_EXEC="${top_builddir}/src/openvpn/openvpn" -SERVER_BASE_OPTS="--daemon --local 127.0.0.1 --dev tun --topology subnet --server 10.29.41.0 255.255.255.0 --max-clients $MAX_CLIENTS --persist-tun --verb 3" +SERVER_BASE_OPTS="--daemon --local 127.0.0.1 --dev tun --topology subnet --max-clients $MAX_CLIENTS --persist-tun --verb 3" SERVER_CIPHER_OPTS="" SERVER_CERT_OPTS="--ca ${CA} --dh ${DH} --cert ${SERVER_CERT} --key ${SERVER_KEY} --tls-auth ${TA} 0" SERVER_CONF_BASE="${SERVER_BASE_OPTS} ${SERVER_CIPHER_OPTS} ${SERVER_CERT_OPTS}"
@@ -32,14 +32,16 @@ TEST_SERVER_LIST="1 2" SERVER_NAME_1="t_server_null_server-1194_udp" +SERVER_SERVER_1="--server 10.29.41.0 255.255.255.0" SERVER_MGMT_PORT_1="11194" SERVER_EXEC_1="${SERVER_EXEC}" -SERVER_CONF_1="${SERVER_CONF_BASE} --lport 1194 --proto udp --management 127.0.0.1 ${SERVER_MGMT_PORT_1}" +SERVER_CONF_1="${SERVER_CONF_BASE} ${SERVER_SERVER_1} --lport 1194 --proto udp --management 127.0.0.1 ${SERVER_MGMT_PORT_1}" SERVER_NAME_2="t_server_null_server-1195_tcp" +SERVER_SERVER_2="--server 10.29.42.0 255.255.255.0" SERVER_MGMT_PORT_2="11195" SERVER_EXEC_2="${SERVER_EXEC}" -SERVER_CONF_2="${SERVER_CONF_BASE} --lport 1195 --proto tcp --management 127.0.0.1 ${SERVER_MGMT_PORT_2}" +SERVER_CONF_2="${SERVER_CONF_BASE} ${SERVER_SERVER_2} --lport 1195 --proto tcp --management 127.0.0.1 ${SERVER_MGMT_PORT_2}" # Test client configurations CLIENT_EXEC="${top_builddir}/src/openvpn/openvpn"
tests/t_server_null_server.sh +39 -14
76 lines not on this page · raw message
tests/t_server_null_stress.sh +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh # # Run this stress test as root to avoid sudo authorization from timing out.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/669?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2cce8ad4e0d262e1404ab1eb6ff673d8590b6b3a
Gerrit-Change-Number: 669
Gerrit-PatchSet: 5
Gerrit-Owner: mattock <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: mattock <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: cron2, mattock, plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/669?usp=email )
Change subject: t_server_null: multiple improvements and fixes
......................................................................
Patch Set 5: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/669?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2cce8ad4e0d262e1404ab1eb6ff673d8590b6b3a
Gerrit-Change-Number: 669
Gerrit-PatchSet: 5
Gerrit-Owner: mattock <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: mattock <[email protected]...>
Gerrit-Comment-Date: Thu, 04 Jul 2024 13:30:06 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH v5 1/1 t_server_null: multiple improvements and fixes
In reply to a message not in the archiveFrom: Samuli Seppänen <[email protected]...>
- exit after a timeout if unable to kill servers
- use sudo or equivalent only for server stop/start
- use /bin/sh directly instead of through /usr/bin/env
- simplify sudo call in the sample rc file
- remove misleading and outdated documentation
- make it work on OpenBSD 7.5
- make it work on NetBSD 10.0
- make server logs readable by normal users
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/669
This mail reflects revision 5 of this Change.
Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <[email protected]...>
doc/t_server_null.rst +6 -7
@@ -43,6 +43,12 @@ * run as root * a privilege escalation tool (sudo, doas, su) and the permission to become root +If you use "doas" you should enable nopass feature in */etc/doas.conf*. For +example to allow users in the *wheel* group to run commands without a password +prompt:: + + permit nopass keepenv :wheel + Technical implementation ------------------------
@@ -73,13 +79,6 @@ * Waits until servers have launched. Then launch all clients, wait for them to exit and then check test results by parsing the client log files. Each client kills itself after some delay using an "--up" script. -Note that "make check" moves on once *t_server_null_client.sh* has exited. At -that point *t_server_null_server.sh* is still running, because it exists only -after waiting a few seconds for more client connections to potentially appear. -This is a feature and not a bug, but means that launching "make check" runs too -quickly might cause test failures or unexpected behavior such as leftover -OpenVPN server processes. - Configuration -------------
tests/t_server_null.rc-sample +1 -2
@@ -1,6 +1,5 @@ # Uncomment to run tests with sudo -#SUDO_EXEC=`which sudo` -#RUN_SUDO="${SUDO_EXEC} -E" +#RUN_SUDO="sudo -E" TEST_RUN_LIST="1 2 3 10 11"
tests/t_server_null.sh +2 -7
@@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh # TSERVER_NULL_SKIP_RC="${TSERVER_NULL_SKIP_RC:-77}"
@@ -57,12 +57,7 @@ srcdir="${srcdir:-.}" -if [ -z "${RUN_SUDO}" ]; then - "${srcdir}/t_server_null_server.sh" & -else - $RUN_SUDO "${srcdir}/t_server_null_server.sh" & -fi - +"${srcdir}/t_server_null_server.sh" & "${srcdir}/t_server_null_client.sh" retval=$?
tests/t_server_null_client.sh +10 -6
@@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh launch_client() { test_name=$1
@@ -76,19 +76,22 @@ count=0 server_max_wait=15 while [ $count -lt $server_max_wait ]; do - server_pids="" - server_count=$(set|grep 'SERVER_NAME_'|wc -l) + servers_up=0 + server_count=$(echo $TEST_SERVER_LIST|wc -w) # We need to trim single-quotes because some shells return quoted values # and some don't. Using "set -o posix" which would resolve this problem is # not supported in all shells. + # + # While inactive server configurations may get checked they won't increase + # the active server count as the processes won't be running. for i in `set|grep 'SERVER_NAME_'|cut -d "=" -f 2|tr -d "[\']"`; do server_pid=$(cat $i.pid 2> /dev/null) - server_pids="${server_pids} ${server_pid}" + if ps -p $server_pid > /dev/null 2>&1; then + servers_up=$(( $servers_up + 1 )) + fi done - servers_up=$(ps -p $server_pids 2>/dev/null|sed '1d'|wc -l) - echo "OpenVPN test servers up: ${servers_up}/${server_count}" if [ $servers_up -ge $server_count ]; then
@@ -101,6 +104,7 @@ if [ $count -eq $server_max_wait ]; then retval=1 + exit $retval fi done
tests/t_server_null_default.rc +5 -3
@@ -24,7 +24,7 @@ MAX_CLIENTS="10" CLIENT_MATCH="Test-Client" SERVER_EXEC="${top_builddir}/src/openvpn/openvpn" -SERVER_BASE_OPTS="--daemon --local 127.0.0.1 --dev tun --topology subnet --server 10.29.41.0 255.255.255.0 --max-clients $MAX_CLIENTS --persist-tun --verb 3" +SERVER_BASE_OPTS="--daemon --local 127.0.0.1 --dev tun --topology subnet --max-clients $MAX_CLIENTS --persist-tun --verb 3" SERVER_CIPHER_OPTS="" SERVER_CERT_OPTS="--ca ${CA} --dh ${DH} --cert ${SERVER_CERT} --key ${SERVER_KEY} --tls-auth ${TA} 0" SERVER_CONF_BASE="${SERVER_BASE_OPTS} ${SERVER_CIPHER_OPTS} ${SERVER_CERT_OPTS}"
@@ -32,14 +32,16 @@ TEST_SERVER_LIST="1 2" SERVER_NAME_1="t_server_null_server-1194_udp" +SERVER_SERVER_1="--server 10.29.41.0 255.255.255.0" SERVER_MGMT_PORT_1="11194" SERVER_EXEC_1="${SERVER_EXEC}" -SERVER_CONF_1="${SERVER_CONF_BASE} --lport 1194 --proto udp --management 127.0.0.1 ${SERVER_MGMT_PORT_1}" +SERVER_CONF_1="${SERVER_CONF_BASE} ${SERVER_SERVER_1} --lport 1194 --proto udp --management 127.0.0.1 ${SERVER_MGMT_PORT_1}" SERVER_NAME_2="t_server_null_server-1195_tcp" +SERVER_SERVER_2="--server 10.29.42.0 255.255.255.0" SERVER_MGMT_PORT_2="11195" SERVER_EXEC_2="${SERVER_EXEC}" -SERVER_CONF_2="${SERVER_CONF_BASE} --lport 1195 --proto tcp --management 127.0.0.1 ${SERVER_MGMT_PORT_2}" +SERVER_CONF_2="${SERVER_CONF_BASE} ${SERVER_SERVER_2} --lport 1195 --proto tcp --management 127.0.0.1 ${SERVER_MGMT_PORT_2}" # Test client configurations CLIENT_EXEC="${top_builddir}/src/openvpn/openvpn"
tests/t_server_null_server.sh +39 -14
76 lines not on this page · raw message
tests/t_server_null_stress.sh +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh # # Run this stress test as root to avoid sudo authorization from timing out.
[Openvpn-devel] [PATCH applied] Re: t_server_null: multiple improvements and fixes
Thanks for the good work on this - now all the more exotic platforms (with stubborn sysadmins) pass "the basic tests", and we can move onwards to more creative setups, and towards better diagnostic output.
Tested on the buildbots (via gerrit).
Your patch has been applied to the master branch.
commit f8f477139804b06183b515a529c982f524547d18
Author: Samuli Seppänen Date: Thu Jul 4 15:33:36 2024 +0200
t_server_null: multiple improvements and fixes
Signed-off-by: Samuli Seppänen <[email protected]...>
Acked-by: Frank Lichtenheld <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg28871.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#6) to the change originally created by mattock. ( http://gerrit.openvpn.net/c/openvpn/+/669?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld
Change subject: t_server_null: multiple improvements and fixes
......................................................................
t_server_null: multiple improvements and fixes
- exit after a timeout if unable to kill servers
- use sudo or equivalent only for server stop/start
- use /bin/sh directly instead of through /usr/bin/env
- simplify sudo call in the sample rc file
- remove misleading and outdated documentation
- make it work on OpenBSD 7.5
- make it work on NetBSD 10.0
- make server logs readable by normal users
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg28871.html
---
M doc/t_server_null.rst
M tests/t_server_null.rc-sample
M tests/t_server_null.sh
M tests/t_server_null_client.sh
M tests/t_server_null_default.rc
M tests/t_server_null_server.sh
M tests/t_server_null_stress.sh
7 files changed, 64 insertions(+), 40 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/669/6
doc/t_server_null.rst +6 -7
@@ -43,6 +43,12 @@ * run as root * a privilege escalation tool (sudo, doas, su) and the permission to become root +If you use "doas" you should enable nopass feature in */etc/doas.conf*. For +example to allow users in the *wheel* group to run commands without a password +prompt:: + + permit nopass keepenv :wheel + Technical implementation ------------------------
@@ -73,13 +79,6 @@ * Waits until servers have launched. Then launch all clients, wait for them to exit and then check test results by parsing the client log files. Each client kills itself after some delay using an "--up" script. -Note that "make check" moves on once *t_server_null_client.sh* has exited. At -that point *t_server_null_server.sh* is still running, because it exists only -after waiting a few seconds for more client connections to potentially appear. -This is a feature and not a bug, but means that launching "make check" runs too -quickly might cause test failures or unexpected behavior such as leftover -OpenVPN server processes. - Configuration -------------
tests/t_server_null.rc-sample +1 -2
@@ -1,6 +1,5 @@ # Uncomment to run tests with sudo -#SUDO_EXEC=`which sudo` -#RUN_SUDO="${SUDO_EXEC} -E" +#RUN_SUDO="sudo -E" TEST_RUN_LIST="1 2 3 10 11"
tests/t_server_null.sh +2 -7
@@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh # TSERVER_NULL_SKIP_RC="${TSERVER_NULL_SKIP_RC:-77}"
@@ -57,12 +57,7 @@ srcdir="${srcdir:-.}" -if [ -z "${RUN_SUDO}" ]; then - "${srcdir}/t_server_null_server.sh" & -else - $RUN_SUDO "${srcdir}/t_server_null_server.sh" & -fi - +"${srcdir}/t_server_null_server.sh" & "${srcdir}/t_server_null_client.sh" retval=$?
tests/t_server_null_client.sh +10 -6
@@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh launch_client() { test_name=$1
@@ -76,19 +76,22 @@ count=0 server_max_wait=15 while [ $count -lt $server_max_wait ]; do - server_pids="" - server_count=$(set|grep 'SERVER_NAME_'|wc -l) + servers_up=0 + server_count=$(echo $TEST_SERVER_LIST|wc -w) # We need to trim single-quotes because some shells return quoted values # and some don't. Using "set -o posix" which would resolve this problem is # not supported in all shells. + # + # While inactive server configurations may get checked they won't increase + # the active server count as the processes won't be running. for i in `set|grep 'SERVER_NAME_'|cut -d "=" -f 2|tr -d "[\']"`; do server_pid=$(cat $i.pid 2> /dev/null) - server_pids="${server_pids} ${server_pid}" + if ps -p $server_pid > /dev/null 2>&1; then + servers_up=$(( $servers_up + 1 )) + fi done - servers_up=$(ps -p $server_pids 2>/dev/null|sed '1d'|wc -l) - echo "OpenVPN test servers up: ${servers_up}/${server_count}" if [ $servers_up -ge $server_count ]; then
@@ -101,6 +104,7 @@ if [ $count -eq $server_max_wait ]; then retval=1 + exit $retval fi done
tests/t_server_null_default.rc +5 -3
@@ -24,7 +24,7 @@ MAX_CLIENTS="10" CLIENT_MATCH="Test-Client" SERVER_EXEC="${top_builddir}/src/openvpn/openvpn" -SERVER_BASE_OPTS="--daemon --local 127.0.0.1 --dev tun --topology subnet --server 10.29.41.0 255.255.255.0 --max-clients $MAX_CLIENTS --persist-tun --verb 3" +SERVER_BASE_OPTS="--daemon --local 127.0.0.1 --dev tun --topology subnet --max-clients $MAX_CLIENTS --persist-tun --verb 3" SERVER_CIPHER_OPTS="" SERVER_CERT_OPTS="--ca ${CA} --dh ${DH} --cert ${SERVER_CERT} --key ${SERVER_KEY} --tls-auth ${TA} 0" SERVER_CONF_BASE="${SERVER_BASE_OPTS} ${SERVER_CIPHER_OPTS} ${SERVER_CERT_OPTS}"
@@ -32,14 +32,16 @@ TEST_SERVER_LIST="1 2" SERVER_NAME_1="t_server_null_server-1194_udp" +SERVER_SERVER_1="--server 10.29.41.0 255.255.255.0" SERVER_MGMT_PORT_1="11194" SERVER_EXEC_1="${SERVER_EXEC}" -SERVER_CONF_1="${SERVER_CONF_BASE} --lport 1194 --proto udp --management 127.0.0.1 ${SERVER_MGMT_PORT_1}" +SERVER_CONF_1="${SERVER_CONF_BASE} ${SERVER_SERVER_1} --lport 1194 --proto udp --management 127.0.0.1 ${SERVER_MGMT_PORT_1}" SERVER_NAME_2="t_server_null_server-1195_tcp" +SERVER_SERVER_2="--server 10.29.42.0 255.255.255.0" SERVER_MGMT_PORT_2="11195" SERVER_EXEC_2="${SERVER_EXEC}" -SERVER_CONF_2="${SERVER_CONF_BASE} --lport 1195 --proto tcp --management 127.0.0.1 ${SERVER_MGMT_PORT_2}" +SERVER_CONF_2="${SERVER_CONF_BASE} ${SERVER_SERVER_2} --lport 1195 --proto tcp --management 127.0.0.1 ${SERVER_MGMT_PORT_2}" # Test client configurations CLIENT_EXEC="${top_builddir}/src/openvpn/openvpn"
tests/t_server_null_server.sh +39 -14
76 lines not on this page · raw message
tests/t_server_null_stress.sh +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh # # Run this stress test as root to avoid sudo authorization from timing out.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/669?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2cce8ad4e0d262e1404ab1eb6ff673d8590b6b3a
Gerrit-Change-Number: 669
Gerrit-PatchSet: 6
Gerrit-Owner: mattock <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/669?usp=email )
Change subject: t_server_null: multiple improvements and fixes
......................................................................
t_server_null: multiple improvements and fixes
- exit after a timeout if unable to kill servers
- use sudo or equivalent only for server stop/start
- use /bin/sh directly instead of through /usr/bin/env
- simplify sudo call in the sample rc file
- remove misleading and outdated documentation
- make it work on OpenBSD 7.5
- make it work on NetBSD 10.0
- make server logs readable by normal users
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg28871.html
---
M doc/t_server_null.rst
M tests/t_server_null.rc-sample
M tests/t_server_null.sh
M tests/t_server_null_client.sh
M tests/t_server_null_default.rc
M tests/t_server_null_server.sh
M tests/t_server_null_stress.sh
7 files changed, 64 insertions(+), 40 deletions(-)
doc/t_server_null.rst +6 -7
@@ -43,6 +43,12 @@ * run as root * a privilege escalation tool (sudo, doas, su) and the permission to become root +If you use "doas" you should enable nopass feature in */etc/doas.conf*. For +example to allow users in the *wheel* group to run commands without a password +prompt:: + + permit nopass keepenv :wheel + Technical implementation ------------------------
@@ -73,13 +79,6 @@ * Waits until servers have launched. Then launch all clients, wait for them to exit and then check test results by parsing the client log files. Each client kills itself after some delay using an "--up" script. -Note that "make check" moves on once *t_server_null_client.sh* has exited. At -that point *t_server_null_server.sh* is still running, because it exists only -after waiting a few seconds for more client connections to potentially appear. -This is a feature and not a bug, but means that launching "make check" runs too -quickly might cause test failures or unexpected behavior such as leftover -OpenVPN server processes. - Configuration -------------
tests/t_server_null.rc-sample +1 -2
@@ -1,6 +1,5 @@ # Uncomment to run tests with sudo -#SUDO_EXEC=`which sudo` -#RUN_SUDO="${SUDO_EXEC} -E" +#RUN_SUDO="sudo -E" TEST_RUN_LIST="1 2 3 10 11"
tests/t_server_null.sh +2 -7
@@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh # TSERVER_NULL_SKIP_RC="${TSERVER_NULL_SKIP_RC:-77}"
@@ -57,12 +57,7 @@ srcdir="${srcdir:-.}" -if [ -z "${RUN_SUDO}" ]; then - "${srcdir}/t_server_null_server.sh" & -else - $RUN_SUDO "${srcdir}/t_server_null_server.sh" & -fi - +"${srcdir}/t_server_null_server.sh" & "${srcdir}/t_server_null_client.sh" retval=$?
tests/t_server_null_client.sh +10 -6
@@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh launch_client() { test_name=$1
@@ -76,19 +76,22 @@ count=0 server_max_wait=15 while [ $count -lt $server_max_wait ]; do - server_pids="" - server_count=$(set|grep 'SERVER_NAME_'|wc -l) + servers_up=0 + server_count=$(echo $TEST_SERVER_LIST|wc -w) # We need to trim single-quotes because some shells return quoted values # and some don't. Using "set -o posix" which would resolve this problem is # not supported in all shells. + # + # While inactive server configurations may get checked they won't increase + # the active server count as the processes won't be running. for i in `set|grep 'SERVER_NAME_'|cut -d "=" -f 2|tr -d "[\']"`; do server_pid=$(cat $i.pid 2> /dev/null) - server_pids="${server_pids} ${server_pid}" + if ps -p $server_pid > /dev/null 2>&1; then + servers_up=$(( $servers_up + 1 )) + fi done - servers_up=$(ps -p $server_pids 2>/dev/null|sed '1d'|wc -l) - echo "OpenVPN test servers up: ${servers_up}/${server_count}" if [ $servers_up -ge $server_count ]; then
@@ -101,6 +104,7 @@ if [ $count -eq $server_max_wait ]; then retval=1 + exit $retval fi done
tests/t_server_null_default.rc +5 -3
@@ -24,7 +24,7 @@ MAX_CLIENTS="10" CLIENT_MATCH="Test-Client" SERVER_EXEC="${top_builddir}/src/openvpn/openvpn" -SERVER_BASE_OPTS="--daemon --local 127.0.0.1 --dev tun --topology subnet --server 10.29.41.0 255.255.255.0 --max-clients $MAX_CLIENTS --persist-tun --verb 3" +SERVER_BASE_OPTS="--daemon --local 127.0.0.1 --dev tun --topology subnet --max-clients $MAX_CLIENTS --persist-tun --verb 3" SERVER_CIPHER_OPTS="" SERVER_CERT_OPTS="--ca ${CA} --dh ${DH} --cert ${SERVER_CERT} --key ${SERVER_KEY} --tls-auth ${TA} 0" SERVER_CONF_BASE="${SERVER_BASE_OPTS} ${SERVER_CIPHER_OPTS} ${SERVER_CERT_OPTS}"
@@ -32,14 +32,16 @@ TEST_SERVER_LIST="1 2" SERVER_NAME_1="t_server_null_server-1194_udp" +SERVER_SERVER_1="--server 10.29.41.0 255.255.255.0" SERVER_MGMT_PORT_1="11194" SERVER_EXEC_1="${SERVER_EXEC}" -SERVER_CONF_1="${SERVER_CONF_BASE} --lport 1194 --proto udp --management 127.0.0.1 ${SERVER_MGMT_PORT_1}" +SERVER_CONF_1="${SERVER_CONF_BASE} ${SERVER_SERVER_1} --lport 1194 --proto udp --management 127.0.0.1 ${SERVER_MGMT_PORT_1}" SERVER_NAME_2="t_server_null_server-1195_tcp" +SERVER_SERVER_2="--server 10.29.42.0 255.255.255.0" SERVER_MGMT_PORT_2="11195" SERVER_EXEC_2="${SERVER_EXEC}" -SERVER_CONF_2="${SERVER_CONF_BASE} --lport 1195 --proto tcp --management 127.0.0.1 ${SERVER_MGMT_PORT_2}" +SERVER_CONF_2="${SERVER_CONF_BASE} ${SERVER_SERVER_2} --lport 1195 --proto tcp --management 127.0.0.1 ${SERVER_MGMT_PORT_2}" # Test client configurations CLIENT_EXEC="${top_builddir}/src/openvpn/openvpn"
tests/t_server_null_server.sh +39 -14
76 lines not on this page · raw message
tests/t_server_null_stress.sh +1 -1
@@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh # # Run this stress test as root to avoid sudo authorization from timing out.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/669?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2cce8ad4e0d262e1404ab1eb6ff673d8590b6b3a
Gerrit-Change-Number: 669
Gerrit-PatchSet: 6
Gerrit-Owner: mattock <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged